home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
32BIT_QD._FO
next >
Wrap
Text File
|
1989-10-26
|
13KB
|
415 lines
Topic 7: Need some development pointers or HELP!!!
# 96: brian (bhamlin) Wed, Oct 25, '89 (23:57) 366 lines
Sure ! The following is an adaptaion of the latest MPW
headers....
/* let's get a real juicy 32bit discussion going based
on this maybe !! */
#ifndef _QuickDraw32Bit_
#define _QuickDraw32Bit_
#ifndef _Quickdraw_
#include <Quickdraw.h>
#endif
#ifndef _Color_
#include <Color.h>
#endif
/* New Constants for 32-Bit QuickDraw */
#define ditherCopy 64 /* Dither mode for Copybits */
#define RGBDirect 16 /* 16 & 32 bits/pixel pixelType value */
/* New error codes */
#define rgnOverflowErr -147 /* Region accumulation failed. Resultinn
may be currupt */
#define pixmapTooDeepErr -148 /* Pixmap is not 1-bit/pixel for BitmapToRegion
*/
#define insufficientStackErr -149 /* QuickDraw could not complete the operation
*/
#define cDepthErr -157 /* invalid pixel depth passed to NewGWor
UpdateGWorld */
#define pixPurgeMask 1
#define noNewDeviceMask 2
/* Flag bits passed to or returned by Offscreen routines */
enum {
pixPurgeBit = 0,
nowNewDeviceBit = 1,
pixelsPurgeableBit = 6,
pixelsLockedBit = 7,
mapPixBit = 16, /* set if color table mapping occurred /
newDepthBit = 17, /* set if pixels were scaled to/
alignPixBit = 18, /* set if pixels were realigned/
newRowBytesBit = 19, /* set if pixmap was reconfigured in a /
reallocPixBit = 20, /* set if offscreen buffer had to be re/
clipPixBit = 28, /* set if pixels were or are to/
stretchPixBit = 29, /* set if pixels were or are to be stre/
ditherPixBit = 30,
gwFlagErrBit = 31
};
typedef enum {
pixPurge = 1 << pixPurgeBit,
nowNewDevice = 1 << nowNewDeviceBit,
pixelsPurgeable = 1 << pixelsPurgeableBit,
pixelsLocked = 1 << pixelsLockedBit,
mapPix = 1 << mapPixBit,
newDepth = 1 << newDepthBit,
alignPix = 1 << alignPixBit,
newRowBytes = 1 << newRowBytesBit,
reallocPix = 1 << reallocPixBit,
clipPix = 1 << clipPixBit,
stretchPix = 1 << stretchPixBit,
ditherPix = 1 << ditherPixBit,
gwFlagErr = 1 << gwFlagErrBit
}GWorldFlag;
typedef long GWorldFlags;
/* Type definition of a GWorldPtr */
typedef CGrafPtr GWorldPtr;
/*
Function Prototypes (necessary to get automatic type coercion -- see LSC
User's Manual p.125)
*/
pascal OSErr BitmapToRegion( RgnHandle, BitMap * );
pascal QDErr NewGWorld( GWorldPtr *, short, Rect *, CTabHandle, GDHa,
GWorldFlags );
pascal Boolean LockPixels( PixMapHandle );
pascal void UnlockPixels( PixMapHandle );
pascal GWorldFlags UpdateGWorld( GWorldPtr *, short, Rect *, CTabHandle,
GDHandle, GWorldFlags );
pascal void DisposeGWorld( GWorldPtr );
pascal void GetGWorld( CGrafPtr *, GDHandle * );
pascal void SetGWorld( CGrafPtr, GDHandle );
pascal void CTabChanged( CTabHandle );
pascal void PixPatChanged( PixPatHandle );
pascal void PortChanged( GrafPtr );
pascal void GDeviceChanged( GDHandle );
pascal void AllowPurgePixels( PixMapHandle );
pascal void NoPurgePixels( PixMapHandle );
pascal GWorldFlags GetPixelsState( PixMapHandle );
pascal void SetPixelsState( PixMapHandle, GWorldFlags );
pascal Ptr GetPixBaseAddr( PixMapHandle );
pascal QDErr NewScreenBuffer( Rect *, Boolean, GDHandle *, PixMapHan;
pascal void DisposeScreenBuffer( PixMapHandle );
pascal GDHandle GetGWorldDevice( GWorldPtr );
pascal OSErr BitmapToRegion( region, bmap )
RgnHandle region;
BitMap *bmap;
{
asm {
SUBQ.L #2,SP
MOVE.L region(A6),-(SP)
MOVE.L bmap(A6),-(SP)
DC.W 0xA8D7
MOVE.W (SP)+,D0
}
}
pascal QDErr NewGWorld( offscreenGWorld, pixelDepth, boundsRect, cTable,
aGDevice, flags )
GWorldPtr *offscreenGWorld;
short pixelDepth;
Rect *boundsRect;
CTabHandle cTable;
GDHandle aGDevice;
GWorldFlags flags;
{
asm {
SUBQ.L #2,SP
MOVE.L offscreenGWorld(A6),-(SP)
MOVE.W pixelDepth(A6),-(SP)
MOVE.L boundsRect(A6),-(SP)
MOVE.L cTable(A6),-(SP)
MOVE.L aGDevice(A6),-(SP)
MOVE.L flags(A6),-(SP)
MOVEQ #0,D0
DC.W 0xAB1D
MOVE.W (SP)+,D0
}
}
pascal Boolean LockPixels( pm )
PixMapHandle pm;
{
asm {
SUBQ.L #2,SP
MOVE.L pm(A6),-(SP)
MOVEQ #1,D0
DC.W 0xAB1D
MOVE.B (SP)+,D0
}
}
pascal void UnlockPixels( pm )
PixMapHandle pm;
{
asm {
MOVE.L pm(A6),-(SP)
MOVEQ #2,D0
DC.W 0xAB1D
}
}
pascal GWorldFlags UpdateGWorld( offscreenGWorld, pixelDepth, boundsRect,
cTable, aGDevice, flags )
GWorldPtr *offscreenGWorld;
short pixelDepth;
Rect *boundsRect;
CTabHandle cTable;
GDHandle aGDevice;
GWorldFlags flags;
{
asm {
SUBQ.L #4,SP
MOVE.L offscreenGWorld(A6),-(SP)
MOVE.W pixelDepth(A6),-(SP)
MOVE.L boundsRect(A6),-(SP)
MOVE.L cTable(A6),-(SP)
MOVE.L aGDevice(A6),-(SP)
MOVE.L flags(A6),-(SP)
MOVEQ #3,D0
DC.W 0xAB1D
MOVE.L (SP)+,D0
}
}
pascal void DisposeGWorld( offscreenGWorld )
GWorldPtr offscreenGWorld;
{
asm {
MOVE.L offscreenGWorld(A6),-(SP)
MOVEQ #4,D0
DC.W 0xAB1D
}
}
pascal void GetGWorld( port, gdh )
CGrafPtr *port;
GDHandle *gdh;
{
asm {
MOVE.L port(A6),-(SP)
MOVE.L gdh(A6),-(SP)
MOVEQ #5,D0
DC.W 0xAB1D
}
}
pascal void SetGWorld( port, gdh )
CGrafPtr port;
GDHandle gdh;
{
asm {
MOVE.L port(A6),-(SP)
MOVE.L gdh(A6),-(SP)
MOVEQ #6,D0
DC.W 0xAB1D
}
}
pascal void CTabChanged( ctab )
CTabHandle ctab;
{
asm {
MOVE.L ctab(A6),-(SP)
MOVEQ #7,D0
DC.W 0xAB1D
}
}
pascal void PixPatChanged( ppat )
PixPatHandle ppat;
{
asm {
MOVE.L ppat(A6),-(SP)
MOVEQ #8,D0
DC.W 0xAB1D
}
}
pascal void PortChanged( port )
GrafPtr port;
{
asm {
MOVE.L port(A6),-(SP)
MOVEQ #9,D0
DC.W 0xAB1D
}
}
pascal void GDeviceChanged( gdh )
GDHandle gdh;
{
asm {
MOVE.L gdh(A6),-(SP)
MOVEQ #0x0A,D0
DC.W 0xAB1D
}
}
pascal void AllowPurgePixels( pm )
PixMapHandle pm;
{
asm {
MOVE.L pm(A6),-(SP)
MOVEQ #0x0B,D0
DC.W 0xAB1D
}
}
pascal void NoPurgePixels( pm )
PixMapHandle pm;
{
asm {
MOVE.L pm(A6),-(SP)
MOVEQ #0x0C,D0
DC.W 0xAB1D
}
}
pascal GWorldFlags GetPixelsState( pm )
PixMapHandle pm;
{
asm {
SUBQ.L #4,SP
MOVE.L pm(A6),-(SP)
MOVEQ #0x0D,D0
DC.W 0xAB1D
MOVE.L (SP)+,D0
}
}
pascal void SetPixelsState( pm, state )
PixMapHandle pm;
GWorldFlags state;
{
asm {
MOVE.L pm(A6),-(SP)
MOVE.L state(A6),-(SP)
MOVEQ #0x0E,D0
DC.W 0xAB1D
}
}
pascal Ptr GetPixBaseAddr( pm )
PixMapHandle pm;
{
asm {
SUBQ.L #4,SP
MOVE.L pm(A6),-(SP)
MOVEQ #0x0F,D0
DC.W 0xAB1D
MOVE.L (SP)+,D0
}
}
pascal QDErr NewScreenBuffer( globalRect, purgeable, gdh, offscreenPixMap )
Rect *globalRect;
Boolean purgeable;
GDHandle *gdh;
PixMapHandle *offscreenPixMap;
{
asm {
SUBQ.L #2,SP
MOVE.L globalRect(A6),-(SP)
MOVE.B purgeable(A6),-(SP)
MOVE.L gdh(A6),-(SP)
MOVE.L offscreenPixMap(A6),-(SP)
MOVEQ #0x10,D0
DC.W 0xAB1D
MOVE.W (SP),D0
}
}
pascal void DisposeScreenBuffer( offscreenPixMap )
PixMapHandle offscreenPixMap;
{
asm {
MOVE.L offscreenPixMap(A6),-(SP)
MOVEQ #0x11,D0
DC.W 0xAB1D
}
}
pascal GDHandle GetGWorldDevice( offscreenGWorld )
GWorldPtr offscreenGWorld;
{
asm {
SUBQ.L #4,SP
MOVE.L offscreenGWorld(A6),-(SP)
MOVEQ #0x12,D0
DC.W 0xAB1D
MOVE.L (SP)+,D0
}
}
#endif
Topic 7: Need some development pointers or HELP!!!
# 97: brian (bhamlin) Thu, Oct 26, '89 (00:10) 35 lines
Drat ! (I think I screwed up the comments and long lines)
for those in the crowd actually wanting to *use* this stuff,
here are the missing pieces, as it were.....
]
-147 /* Region accumulation failed. Resulting region may be currupt */
-148 /* Pixmap is not 1-bit/pixel for BitmapToRegion */
-149 /* QuickDraw could not complete the operation */
-157 /* invalid pixel depth passed to NewGWorld or UpdateGWorld */
/*
Function Prototypes (necessary to get automatic type coercion
-- see LSC User's Manual p.125)
*/
NewGWorld( GWorldPtr *, short, Rect *, CTabHandle, GDHandle, GWorldFlags );
UpdateGWorld( GWorldPtr *, short, Rect *, CTabHandle, GDHandle, GWorldFlags );
NewGWorld( offscreenGWorld, pixelDepth, boundsRect, cTable, aGDevice, flags )
UpdateGWorld( offscreenGWorld, pixelDepth, boundsRect, cTable, aGDevice, flags
)
)
/* I think that's it - check it out, write something fun.
Remember: You don't have to have a 32bit video card,
just Sys 6.0.3 or greater on a color-capable machine
and the 32bit Quickdraw INIT in your system folder to
use these calls !
*/
Topic 7: Need some development pointers or HELP!!!
# 98: brian (bhamlin) Thu, Oct 26, '89 (01:56) 2 lines
/* hoo-boy, well ANYWAY thanks to Sam Roberts for
assembler tweaking. Other Than That, ga */